﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Add</title>
    <link href="~/Content/layui/css/layui.css" rel="stylesheet" />
</head>
<body>
    <div>
        <form class="layui-form" action="">
            <input type="hidden" name="realId" id="realId" value="@Model.Id" />
            <div class="layui-form-item">
                <label class="layui-form-label">用户名</label>
                <div class="layui-input-block">
                    <input type="text" name="UserName" id="UserName" value="@Model.UserName" required lay-verify="required" placeholder="请输入歌曲名" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">性别</label>
                <div class="layui-input-block">
                    <select id="Sex" name="Sex">
                        @if (Model.Sex == "男")
                        {

                            <option value="">请选择</option>
                            <option value="男" selected="selected">男</option>
                            <option value="女">女</option>
                           
                        }
                        else if (Model.Sex == "女")
                        {
                            <option value="">请选择</option>
                            <option value="男">男</option>
                            <option value="女" selected="selected">女</option>
                           
                        }
                    </select>


                </div>



            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
    <script src="~/Content/layui/layui.js"></script>
    <script>
        //Demo
        layui.use('form', function () {
            var form = layui.form;
            var $ = layui.$;
            var layer = layui.layer;
            var layer = layui.layer;
            var laydate = layui.laydate;
            //开始日期范围
            laydate.render({
                elem: '#Birthday'
            });
            //监听提交
            form.on('submit(formDemo)', function (data) {

                $.post("/User/Update", {
                    "realId": $("#realId").val(),
                    "UserName": $("#UserName").val(),
                    "Sex": $("#Sex").val(),
                }, function (res) {
                    if (res.Success) {
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index); //再执行关闭
                        window.parent.location.reload();
                        layer.msg(res.Message)
                    } else {
                        layer.msg(res.Message)
                    }

                })
                return false;
            });
        });
    </script>
</body>
</html>
